<!DOCTYPE html>
<html lang="zh">

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <link href="../css/style.css" rel="stylesheet"> </head>

<body>
    <div id="myApp">
        <p>您最喜欢的游戏是：{{mygame}}</p>
        <button v-on:click="btnClick('我的世界')">我的世界</button>
        <button v-on:click="btnClick('勇者斗恶龙')">勇者斗恶龙</button>
        <button v-on:click="btnClick('塞尔达传说')">塞尔达传说</button>
        <button @click="btnClick('魔界战记5')">魔界战记5</button>
    </div>
    <script>
        var myApp = new Vue({
            el: '#myApp',
            data: {
                mygame: '超级马里奥'
            },
            methods: {
                btnClick: function(pname) {
                    this.mygame = pname;
                },
            },
        });
    </script>
</body>

</html>